package com.ytjj.bigdata.controller;

import com.ytjj.bigdata.entity.AdsExpose;
import com.ytjj.bigdata.service.AdsExposeService;
import com.ytjj.common.api.CommonResult;
import com.ytjj.common.model.ExposureNumResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/adsExpose")
@Slf4j
public class AdxExposeController {
    @Autowired
    private AdsExposeService adsExposeService;

    @GetMapping("/sumDataByUserId")
    public CommonResult sumDataByUserId(@RequestParam Integer userId) {
        return CommonResult.success(adsExposeService.sumDataByUserId(userId));
    }

    @GetMapping("/sumExposureByDynamicId")
    public ExposureNumResponse sumExposureByDynamicId(@RequestParam Integer dynamicId) {
        log.info("====sumExposureByDynamicId=====");
        Integer value = adsExposeService.sumExposureByDynamicId(dynamicId);
        ExposureNumResponse response = new ExposureNumResponse();
        response.setExposureNum(value);
        return response;
    }
    @GetMapping("/scheduleTask")
    public List<AdsExpose> scheduleTask() {
        log.info("===enter===scheduleTask");
        return adsExposeService.scheduleTask();
    }

}
